#include "base/MemoryRequest.h"

NEW_DELETE_OPERATORS_CPP(MemoryRequest,1);

MemoryRequest::MemoryRequest (VA addr, Processor* p, Entity* source, Entity* dest, uint size)
    : Request(source, dest, size),
      initiatingRequest(NULL),
      address(addr),
      processor(p)
{
}

MemoryRequest::~MemoryRequest () {
}

VA MemoryRequest::getAddress () const {
    return address;
}

Processor* MemoryRequest::getProcessor () const {
    return processor;
}

void MemoryRequest::recursiveDelete () {
    if (initiatingRequest != NULL) {
        initiatingRequest->recursiveDelete();
        delete initiatingRequest;
    }
}

Entity* MemoryRequest::getInitiatingRequester() const {
    if (initiatingRequest != NULL) {
        return initiatingRequest->getInitiatingRequester();
    } else {
        return getSource();
    }
}
